package com.jt.config;

import com.jt.vo.SysResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice//@ControllerAdvice+@ResponseBody通知,返回json串
public class MyException {

 @ExceptionHandler(RuntimeException.class)
 public Object handler(Exception exception){
  exception.printStackTrace();//打印错误信息
  return SysResult.fail();
 }
}
